import axios from "axios";

export function uploadFile(file, callback) {
  let formData = new FormData();
  formData.append("file", file);
  axios
    .post("/api/file/upload",formData,{
      headers: {
        "Content-Type": "multipart/form-data",
      },
    })
    .then((response) => {
      if (callback != undefined) callback(response.data);
    })
    .catch((error) => {
      console.error("上传失败", error);
    });
}
